package com.mypofolio.gui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import org.apache.commons.configuration.ConfigurationException;

import com.mypofolio.model.TableModel;


/**
 * @author  Paolo Cappelletti (Gempliss Srl)
 */
public class MainWindow extends JFrame {
	
	
	public MainWindow() throws FileNotFoundException, IOException, ConfigurationException{
		super();
		this.setSize(900,900);
		this.setTitle("MyPoFolio");
		TableModel tm=new com.mypofolio.model.TableModel(); 
		tm.init();
	    JTable table = new JTable(tm);
	    JScrollPane scrollpane = new JScrollPane(table);
	    this.getContentPane().setLayout(new BorderLayout());   
	    this.getContentPane().add(scrollpane);
	    
	    JMenuBar menuBar = new JMenuBar();
	    JMenu fileMenu = new JMenu("File");
	    menuBar.add(fileMenu);
	    JMenuItem newAction =   new JMenuItem(new AbstractAction("Exit") {			    	
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);			
			}
		});
	    fileMenu.add(newAction);
	    this.setJMenuBar(menuBar);
	}

}
